<template>
  <a-input v-model="email" @blur="OnSubscribe" v-bind="$attrs" />
</template>
<script>
export default {
  name: 'email',
  components: {},
  props: ['value'],
  data() {
    return {
      email: ''
    }
  },
  watch: {},
  computed: {},
  methods: {
    OnSubscribe() {
      const reg = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/
      let str = this.email
      if (!reg.test(str)) {
        this.$message.warning('邮件格式错误')
      }
    }
  },
  created() {},
  mounted() {
    this.email = this.value
  }
}
</script>
<style lang="css" scoped></style>
